package com.nine.controller;

import com.nine.entity.MyReturn;
import com.nine.entity.TesterFpa;
import com.nine.service.impl.TesterServiceImpl;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description:验证测试的用户是否存在与测试用户表中
 * @Author:LouFangRui
 * @Date:2022/6/27 15:24
 */
@RestController
@RequestMapping("testLogin")
public class TesterLoginController extends ControllerFather {
	@Autowired
	private TesterServiceImpl testerService;

	MyReturn myReturn=new MyReturn();

	@RequestMapping("selectTester.do")
	public MyReturn selectTester(String name,String phone,Integer testCode) {
		List<TesterFpa> a = testerService.selectTester(name,phone,testCode);
		List<TesterFpa> b = testerService.selectCode(testCode);
		System.out.println(b);
		if (b.size()>0 && a.size()>0){
			return super.getSuccessResult(myReturn);
		}else if (b.size()==0){
			return super.getNotTestCode(myReturn);
		}else {
			return super.getFailResult(myReturn);
		}
	}
}
